package sensitivity;

import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;

import javax.swing.JFrame;

import cpasl.CpaslPanel;

public class SensitivityFrame extends JFrame {
	
	public SensitivityFrame(int participantNumber) {
		Toolkit toolkit = Toolkit.getDefaultToolkit();  
		int xSize = ((int) toolkit.getScreenSize().getWidth());  
		int ySize = ((int) toolkit.getScreenSize().getHeight()); 
		SensitivityPanel panel = new SensitivityPanel(xSize, ySize, participantNumber);
		setContentPane(panel);
		setUndecorated(true);
		setSize(xSize, ySize);
		KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager();
		keyboardFocusManager.addKeyEventDispatcher(new KeyEventDispatcher() {

			@Override
			public boolean dispatchKeyEvent(KeyEvent e) {
				if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
					System.exit(0);
				}
				return false;
			}
			
		});
	}

}
